home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
New Star Software Collection
/
NSS_Collection.iso
/
3-170 dbase 10 for windows
/
1.ima
/
SAMPLES.PAK
/
LINKLIST.PRG
< prev
next >
Wrap
Text File
|
1993-07-26
|
2KB
|
65 lines
*******************************************************************************
* PROGRAM: Linklist.prg
*
* WRITTEN BY: Borland Late Night Crew
*
* DATE: 6/93
*
* UPDATED:
*
* VERSION: Alpha α
*
* DESCRIPTION: This program creates a simple linked list of integers
* from 1 to 10. Each link in the chain is an instance of the
* MyList class, which has 2 properties -- value, and next.
* After the list is created, the function ShowList steps
* through the list and shows all the links that have been
* created.
*
* PARAMETERS: None
*
* CALLS: None
*
* USAGE: DO Linklist
*
*******************************************************************************
* a simple xbase linked-list:
set talk off
* beginning of the list
x = new mylist() && instantiation
y = x && y is a temporary reference for stepping through the list
for i = 1 to 10
y.val = i
y.next = new mylist() && create a new link
y = y.next
next
do showlist
* class definition for mylist
*******************************************************************************
class mylist
*******************************************************************************
this.val = 0
this.next = 0
endclass
*******************************************************************************
function showlist
* Displays the linked list created in the main program
*******************************************************************************
y = x && start at the beginning of the list
do while (.not. empty(y))
? y.val
y = y.next
enddo
**************************** End of Linklist.prg ******************************